package com.dm.frontend.controller;


import com.alibaba.dubbo.config.annotation.Reference;
import com.dm.common.utils.DubboUtil;

import com.dm.home.service.DmAreaService;
import com.dm.module.DmArea;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping
public class HomeController {

    @Reference(url = DubboUtil.DUBBO_URL_HOME,version = DubboUtil.VERSION_1, group = DubboUtil.GROUP_NAME)
    private DmAreaService dmAreaService;

    @RequestMapping("/")
    public String home(){

        return "home/home";
    }

    @RequestMapping("home")
    public String getDmArea(Model model){
        List<DmArea> list = dmAreaService.getAll();
        model.addAttribute("DmAreaList",list);
        return "home";
    }
}
